package com.jin.Msg;

import lombok.Data;

@Data
public class Result {

    private String Code;  //状态码 200正常；400错误
    private String Msg;  //提示信息
    private Object data;    //对象

    //操作成功
    public static Result cuss(Object data){
        return cuss("200","操作成功",data);
    }

    public static Result cuss(String Code,String Msg,Object data){
        Result result = new Result();
        result.setCode(Code);
        result.setMsg(Msg);
        result.setData(data);
        return result;
    }

    //操作失败
    public static Result fail(String Msg){
        return fail("400",Msg,null);
    }

    public static Result fail(String Msg,Object data){
        return fail("400",Msg,data);
    }


    public static Result fail(String Code,String Msg,Object data){
        Result result = new Result();
        result.setCode(Code);
        result.setMsg(Msg);
        result.setData(data);
        return result;
    }
}
